home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 December / Australian PC User - December 2003 (CD2).iso / software / apps / files / dwmx2k4.exe / Disk1 / data1.cab / Configuration_En / Commands / CustomizeFavoritesClass.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  21.8 KB  |  728 lines

  1. //SHARE-IN-MEMORY=true
  2. // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  3.  
  4. //--------------------------------------------------------------------
  5. // CLASS:
  6. //   CustomizeFavorites
  7. //
  8. // DESCRIPTION:
  9. //   This class is used to by the Customize Favorite Objects dialog to 
  10. //   interface (read/write) with the insertbar.xml file  
  11. //
  12. // PUBLIC FUNCTIONS:
  13. //
  14. //   initializeUI() - initializes the UI 
  15. //   store()        - processes the UI and writes out XML to the favorites category of insertbar.xml 
  16. //   addSeparator() - helper function that adds a separator bar 
  17. //   addFavorite()  - helper UI function that adds 
  18.  
  19.  
  20. //*************** GLOBALS VARS *****************
  21. var aObjectPath = dw.getConfigurationPath() + "//Objects//insertbar.xml"; 
  22. var SEPARATOR = "------"; 
  23. var SPACER = " - "; 
  24. var FAVORITEIDSUFFIX = "Fav"; 
  25.  
  26. //*-------------------------------------------------------------------
  27. // OBJECT:
  28. //    CustomizeFavorites
  29. //--------------------------------------------------------------------
  30.  
  31. // public methods 
  32.  
  33. CustomizeFavorites.prototype.initializeUI   = CustomizeFavorites_initializeUI; 
  34. CustomizeFavorites.prototype.addSeparator   = CustomizeFavorites_addSeparator; 
  35. CustomizeFavorites.prototype.store          = CustomizeFavorites_store; 
  36. CustomizeFavorites.prototype.deleteFavorite = CustomizeFavorites_deleteFavorite; 
  37. CustomizeFavorites.prototype.addFavorite    = CustomizeFavorites_addFavorite; 
  38. CustomizeFavorites.prototype.upButton       = CustomizeFavorites_upButton; 
  39. CustomizeFavorites.prototype.downButton     = CustomizeFavorites_downButton; 
  40. CustomizeFavorites.prototype.setAddButtonDisabled     = CustomizeFavorites_setAddButtonDisabled; 
  41. CustomizeFavorites.prototype.setAvailableObjects = CustomizeFavorites_setAvailableObjects; 
  42. CustomizeFavorites.prototype.insertBarDOM = ""; 
  43.  
  44. //--------------------------------------------------------------------
  45. // FUNCTION:
  46. //   CustomizeFavorites
  47. //
  48. // DESCRIPTION:
  49. //   Constructor
  50. //
  51. // ARGUMENTS:
  52. //   none
  53. //
  54. // RETURNS:
  55. //   none
  56. //--------------------------------------------------------------------
  57.  
  58. function CustomizeFavorites(AVAILABLE_OBJECTS_LIST,FAVORITE_OBJECTS_LIST,AVAILABLE_CATEGORIES_LIST)
  59. {
  60.   this.AVAILABLE_OBJECTS_LIST =  AVAILABLE_OBJECTS_LIST; 
  61.   this.FAVORITE_OBJECTS_LIST = FAVORITE_OBJECTS_LIST; 
  62.   this.AVAILABLE_CATEGORIES_LIST = AVAILABLE_CATEGORIES_LIST; 
  63. }
  64.  
  65. //--------------------------------------------------------------------
  66. // FUNCTION:
  67. //   SQLStatement.initializeUI
  68. //
  69. // DESCRIPTION:
  70. //   Initializes the UI for the Customize Favorites Object dialog 
  71. //
  72. // ARGUMENTS:
  73. //   none
  74. //
  75. // RETURNS:
  76. //   true if successful, false otherwise 
  77. //--------------------------------------------------------------------
  78.  
  79. function CustomizeFavorites_initializeUI()
  80. {
  81.   // initialize variables
  82.   var theDOM = dw.getDocumentDOM(aObjectPath); 
  83.   var theCategories; 
  84.   var theCategoryNames = new Array(MM.LABEL_CustomizeObjectsAll); 
  85.   var theCategoryValues = new Array("all"); 
  86.   var theButtons; 
  87.   var buttonNames = new Array(); 
  88.   var buttonValues = new Array(); 
  89.   var favoriteNames = new Array(); 
  90.   var favoriteValues = new Array(); 
  91.   var retValue = false; 
  92.   
  93.   if (theDOM) 
  94.   {
  95.     // get all of <category> tags 
  96.     theCategories = theDOM.getElementsByTagName("category");
  97.        
  98.     // if we have some categories 
  99.     if (theCategories && theCategories.length)
  100.     {                 
  101.       this.insertBarDOM = theDOM; 
  102.  
  103.       // for every category 
  104.       for (var z=0;z<theCategories.length;++z)
  105.       {
  106.         // if the current actegory node exists 
  107.         if (theCategories[z])
  108.         {
  109.           // and it has both a name and an ID 
  110.           if (theCategories[z].id && theCategories[z].id.length && theCategories[z].name && theCategories[z].name.length)
  111.           {           
  112.             // and we're not dealing with the favorites (we want to exclude this) 
  113.             if (theCategories[z].id != "DW_Insertbar_Favorites")
  114.             {
  115.               // add to filter list arrays 
  116.               theCategoryNames.push(theCategories[z].name); 
  117.               theCategoryValues.push(theCategories[z].id); 
  118.  
  119.               // for every category 
  120.               // var cleanCategory = theCategories[z].id.replace("dw_InsertBar_", "", "gi"); 
  121.             
  122.               // add to the button names the name and an empty string as the value 
  123.               buttonNames.push(theCategories[z].name); 
  124.               buttonValues.push(""); 
  125.               
  126.               // grab all the the buttons for this category 
  127.               var theButtons = theCategories[z].getElementsByTagName("button");            
  128.           
  129.               // for every button in this category 
  130.               for (var i=0;i<theButtons.length;++i)
  131.               {  
  132.                 // if it has a name and an ID 
  133.                 if (theButtons[i].id && theButtons[i].id.length && theButtons[i].name && theButtons[i].name.length)
  134.                 {
  135.                   // push the button name and id 
  136.                   buttonNames.push(SPACER + theButtons[i].name); 
  137.                   buttonValues.push(theButtons[i].id); 
  138.                 }
  139.               }
  140.             }
  141.             else if (theCategories[z].id == "DW_Insertbar_Favorites")
  142.             {
  143.               var theChildCategoryNodes = theCategories[z].childNodes; 
  144.                             
  145.               if (theChildCategoryNodes && theChildCategoryNodes.length)
  146.               {
  147.                 for (var i=0;i<theChildCategoryNodes.length;++i)
  148.                 {
  149.                   // alert(theChildCategoryNodes[i].tagName); 
  150.                   if (theChildCategoryNodes[i].tagName.toLowerCase() == "separator" )
  151.                   {
  152.                     favoriteNames.push(SEPARATOR); 
  153.                     favoriteValues.push("separator"); 
  154.                   }
  155.                   else 
  156.                   {
  157.                     if (theChildCategoryNodes[i].name && theChildCategoryNodes[i].name.length && theChildCategoryNodes[i].id && theChildCategoryNodes[i].id.length)
  158.                     {
  159.                       favoriteNames.push(theChildCategoryNodes[i].name); 
  160.                       favoriteValues.push(theChildCategoryNodes[i].id); 
  161.                     }
  162.                   }
  163.                 }
  164.               }
  165.               else
  166.               {
  167.                 // ** There were no categories found. 
  168.                 // alert("Error: this category does not appear to have a valid category."); 
  169.               }
  170.  
  171.               /*
  172.               // in the case of the favorites category, we want to add this to 
  173.               // the favorites list control 
  174.               var theButtons = theCategories[z].getElementsByTagName("button"); 
  175.                         
  176.               // for every button in the the favorites cateogry 
  177.               for (var i=0;i<theButtons.length;++i)
  178.               {               
  179.                 // if the button has a realy name and id 
  180.                 if (theButtons[i].name && theButtons[i].name.length && theButtons[i].id && theButtons[i].id.length)
  181.                 { 
  182.                   // push the id and names 
  183.                   favoriteNames.push(theButtons[i].name); 
  184.                   favoriteValues.push(theButtons[i].id); 
  185.                 }
  186.               } 
  187.               
  188.               */            
  189.             }
  190.           }
  191.         }    
  192.         
  193.         if (z < (theCategories.length-1))
  194.         {
  195.           buttonNames.push(""); 
  196.           buttonValues.push("");
  197.         }  
  198.       }
  199.      
  200.       // set the values for all lists 
  201.       this.AVAILABLE_CATEGORIES_LIST.setAll(theCategoryNames,theCategoryValues);       
  202.       this.AVAILABLE_OBJECTS_LIST.setAll(buttonNames,buttonValues); 
  203.       this.FAVORITE_OBJECTS_LIST.setAll(favoriteNames,favoriteValues); 
  204.       
  205.       // set focus to available objects list 
  206.       this.AVAILABLE_OBJECTS_LIST.focus(); 
  207.  
  208.       retValue = true; 
  209.     }
  210.     else
  211.     {
  212.       alert("There were no button ID's found."); 
  213.     }    
  214.   }  
  215.   return retValue; 
  216. }
  217.  
  218.  
  219. //--------------------------------------------------------------------
  220. // FUNCTION:
  221. //   SQLStatement.store
  222. //
  223. // DESCRIPTION:
  224. //   Writes the favorite objects specified by the user to insertbar.xml and, 
  225. //   once completed, reloads all objects in the Insert Bar. 
  226. //
  227. // ARGUMENTS:
  228. //   none
  229. //
  230. // RETURNS:
  231. //   true if successful, false otherwise 
  232. //--------------------------------------------------------------------
  233.  
  234. function CustomizeFavorites_store()
  235. {
  236.   var favoritesXML = ""; 
  237.   var buttonNodes; 
  238.  
  239.   // close the window 
  240.   window.close();
  241.  
  242.   // get the DOM of the insert bar 
  243.   var theDOM = dw.getDocumentDOM(aObjectPath);
  244.  
  245.   // otherwise if we have a valid DOM 
  246.   if (theDOM)
  247.   {
  248.     // get all of the button ID's 
  249.     buttonNodes = theDOM.getElementsByTagName("button");    
  250.   } 
  251.      
  252.   // if there's at least one favorite 
  253.   if (this.FAVORITE_OBJECTS_LIST.getLen() > 0)
  254.   {
  255.  
  256.     // define a new profiler object
  257.     // var aProfiler = new Profiler(); 
  258.     // aProfiler.addCapture("Begin Profile -- Preparing to call fooBar()"); 
  259.     
  260.     // for every object in the favorite objects list 
  261.     for (var i=0;i<this.FAVORITE_OBJECTS_LIST.getLen();++i)
  262.     {
  263.       // add a time stamp 
  264.       // aProfiler.addCapture("i= " + i);
  265.       
  266.       //  get the current value  
  267.       var curValue = this.FAVORITE_OBJECTS_LIST.getValue(i); 
  268.       
  269.       // if the current value exists 
  270.       if (curValue && curValue.length)
  271.       {
  272.         // if the cur value is a separator 
  273.         if (curValue == "separator")
  274.         {
  275.           // add separator code 
  276.           favoritesXML += "\n\r" + "<separator />"; 
  277.         }
  278.                       
  279.         // set the foundNode var to default false 
  280.         var foundNode = false; 
  281.           
  282.         // for every button 
  283.         for (var k=0;k<buttonNodes.length;++k)
  284.         {
  285.           // if we haven't found the node 
  286.           if (!foundNode)
  287.           {
  288.             // if the current button id matches the current vlaue 
  289.             if (buttonNodes[k].id == curValue)
  290.             {
  291.               // alert("found node!" + buttonNodes[k].outerHTML); 
  292.               foundNode = true; 
  293.               var id = buttonNodes[k].id; 
  294.               
  295.               if (id.substring(id.length-3,id.length) != FAVORITEIDSUFFIX)
  296.               {
  297.                 buttonNodes[k].id = buttonNodes[k].id + FAVORITEIDSUFFIX; 
  298.               } 
  299.               
  300.               favoritesXML += "\n\r" + buttonNodes[k].outerHTML; 
  301.             }
  302.           }
  303.         }
  304.       }
  305.     }
  306.   } 
  307.   else
  308.   {
  309.     favoritesXML = "empty"; 
  310.   }
  311.   
  312.   // if we have some xml that was created 
  313.   if (favoritesXML && favoritesXML != "" && theDOM)
  314.   {      
  315.     if (favoritesXML == "empty")
  316.     {
  317.       favoritesXML = ""; 
  318.     }
  319.     
  320.     // get an empty DOM so we can add the XML to it since
  321.     // we cannot directly alert the source DOM. Later, we 
  322.     // will reassign the outer HTML of that DOM to this one 
  323.     
  324.     var newDOM = dwscripts.getEmptyDOM(); 
  325.     
  326.     newDOM.documentElement.outerHTML = theDOM.documentElement.outerHTML; 
  327.     
  328.     var arrCategories = newDOM.getElementsByTagName("category"); 
  329.     
  330.     for (var z = 0; z<arrCategories.length;++z)
  331.     {
  332.       if (arrCategories[z].id && arrCategories[z].id == "DW_Insertbar_Favorites")
  333.       {
  334.         arrCategories[z].innerHTML = favoritesXML; 
  335.       }
  336.     }
  337.     
  338.     theDOM.documentElement.outerHTML = newDOM.documentElement.outerHTML;  
  339.  
  340.     var writeResult = DWfile.write(aObjectPath,   theDOM.documentElement.outerHTML); 
  341.            
  342.     if (writeResult)
  343.     {
  344.       dw.reloadObjects();
  345.  
  346.     }
  347.     else 
  348.     {
  349.       alert("Error: Unable to write out to insertobject.xml file. "); 
  350.     }
  351.   }
  352.  
  353.  
  354.  
  355. //--------------------------------------------------------------------
  356. // FUNCTION:
  357. //   addSeparator
  358. //
  359. // DESCRIPTION:
  360. //   Adds a separator item to the favorites list control after the currently 
  361. //   selected item. A separator appears as a vertical line and helps the 
  362. //   user define a set of related objects in the Favorites bar. 
  363. //
  364. // ARGUMENTS:
  365. //   none
  366. //
  367. // RETURNS:
  368. //   true if successful, false otherwise
  369. //--------------------------------------------------------------------
  370.  
  371. function CustomizeFavorites_addSeparator()
  372. {
  373.   var retValue = true; 
  374.   this.FAVORITE_OBJECTS_LIST.add(SEPARATOR, "separator"); 
  375.   
  376.   return retValue; 
  377. }
  378.  
  379. //--------------------------------------------------------------------
  380. // FUNCTION:
  381. //   deleteFavorite
  382. //
  383. // DESCRIPTION:
  384. //   Deletes the currently selected item in the favorites list. 
  385. //
  386. // ARGUMENTS:
  387. //   none
  388. //
  389. // RETURNS:
  390. //   true if successful, false otherwise
  391. //--------------------------------------------------------------------
  392.  
  393. function CustomizeFavorites_deleteFavorite()
  394. {
  395.   var retValue = true; 
  396.   this.FAVORITE_OBJECTS_LIST.del(); 
  397.   
  398.   return retValue; 
  399. }
  400.  
  401. //--------------------------------------------------------------------
  402. // FUNCTION:
  403. //   addFavorite
  404. //
  405. // DESCRIPTION:
  406. //   Adds the selected object from the available objects list into 
  407. //   the favorites list
  408. //
  409. // ARGUMENTS:
  410. //   none
  411. //
  412. // RETURNS:
  413. //   true if successful, false otherwise 
  414. //--------------------------------------------------------------------
  415.  
  416. function CustomizeFavorites_addFavorite()
  417. {
  418.   var retValue = false; 
  419.   var selectedObject = this.AVAILABLE_OBJECTS_LIST.getValue(); 
  420.   
  421.   var canAdd = true; 
  422.  
  423.   if (!selectedObject || selectedObject == "")
  424.   {
  425.     canAdd = false; 
  426.   }
  427.   
  428.   if (canAdd)
  429.   {
  430.     for (var i=0;i<this.FAVORITE_OBJECTS_LIST.getLen();++i)
  431.     {
  432.       if (this.FAVORITE_OBJECTS_LIST.getValue(i))
  433.       {
  434.         if (this.FAVORITE_OBJECTS_LIST.getValue(i) == selectedObject)
  435.         {
  436.           canAdd = false; 
  437.           alert(MM.MSG_CustomizeObjectsAlreadyAdded); 
  438.         }
  439.       }
  440.     }
  441.   } 
  442.   
  443.   if (canAdd)
  444.   {
  445.     var curName = this.AVAILABLE_OBJECTS_LIST.get(); 
  446.     curName = curName.replace(SPACER, "", "gi"); 
  447.     this.FAVORITE_OBJECTS_LIST.add(curName, this.AVAILABLE_OBJECTS_LIST.getValue());
  448.     retValue = true; 
  449.   }    
  450.   
  451.   return retValue; 
  452. }
  453.  
  454.  
  455. //--------------------------------------------------------------------
  456. // FUNCTION:
  457. //   upBotton
  458. //
  459. // DESCRIPTION:
  460. //   Adds a separator item to the favorites list control after the currently 
  461. //   selected item. A separator appears as a vertical line and helps the 
  462. //   user define a set of related objects in the Favorites bar. 
  463. //
  464. // ARGUMENTS:
  465. //   none
  466. //
  467. // RETURNS:
  468. //   true if successful, false otherwise
  469. //--------------------------------------------------------------------
  470.  
  471. function CustomizeFavorites_upButton()
  472. {
  473.   var retValue = true; 
  474.   var curIndex = this.FAVORITE_OBJECTS_LIST.getIndex(); 
  475.   var curLength = this.FAVORITE_OBJECTS_LIST.getLen(); 
  476.  
  477.   if (curIndex == 0)
  478.   {
  479.     //
  480.   }
  481.   else if (curLength == curIndex)
  482.   {
  483.     // 
  484.   }
  485.   else 
  486.   {
  487.     var preIndex = this.FAVORITE_OBJECTS_LIST.getIndex() -1; 
  488.     
  489.     var curValue = this.FAVORITE_OBJECTS_LIST.getValue(); 
  490.     var preValue = this.FAVORITE_OBJECTS_LIST.getValue(curIndex-1); 
  491.     
  492.     var curText = this.FAVORITE_OBJECTS_LIST.get(); 
  493.     var preText = this.FAVORITE_OBJECTS_LIST.get(curIndex-1); 
  494.     
  495.     this.FAVORITE_OBJECTS_LIST.set(curText, preIndex); 
  496.     this.FAVORITE_OBJECTS_LIST.setValue(curValue, preIndex); 
  497.  
  498.     this.FAVORITE_OBJECTS_LIST.set(preText, curIndex); 
  499.     this.FAVORITE_OBJECTS_LIST.setValue(preValue, curIndex);    
  500.     this.FAVORITE_OBJECTS_LIST.setIndex(preIndex);      
  501.   }
  502.   
  503.   
  504.   return retValue; 
  505. }
  506.  
  507. //--------------------------------------------------------------------
  508. // FUNCTION:
  509. //   downButton
  510. //
  511. // DESCRIPTION:
  512. //   Adds a separator item to the favorites list control after the currently 
  513. //   selected item. A separator appears as a vertical line and helps the 
  514. //   user define a set of related objects in the Favorites bar. 
  515. //
  516. // ARGUMENTS:
  517. //   none
  518. //
  519. // RETURNS:
  520. //   true if successful, false otherwise
  521. //--------------------------------------------------------------------
  522.  
  523. function CustomizeFavorites_downButton()
  524. {
  525.   var retValue = true; 
  526.   var curIndex = this.FAVORITE_OBJECTS_LIST.getIndex(); 
  527.   var curLength = this.FAVORITE_OBJECTS_LIST.getLen(); 
  528.  
  529.   if (curLength == curIndex+1)
  530.   {
  531.     // alert("not moving because index is at the bottom."); 
  532.   }
  533.   else 
  534.   {
  535.     var nextIndex = this.FAVORITE_OBJECTS_LIST.getIndex() +1; 
  536.     
  537.     var curValue = this.FAVORITE_OBJECTS_LIST.getValue(); 
  538.     var nextValue = this.FAVORITE_OBJECTS_LIST.getValue(curIndex+1); 
  539.     
  540.     var curText = this.FAVORITE_OBJECTS_LIST.get(); 
  541.     var nextText = this.FAVORITE_OBJECTS_LIST.get(curIndex+1); 
  542.     
  543.     this.FAVORITE_OBJECTS_LIST.set(curText, nextIndex); 
  544.     this.FAVORITE_OBJECTS_LIST.setValue(curValue, nextIndex); 
  545.  
  546.     this.FAVORITE_OBJECTS_LIST.set(nextText, curIndex); 
  547.     this.FAVORITE_OBJECTS_LIST.setValue(nextValue, curIndex);    
  548.     this.FAVORITE_OBJECTS_LIST.setIndex(nextIndex);      
  549.   }
  550.   
  551.   return retValue; 
  552. }
  553.  
  554. //--------------------------------------------------------------------
  555. // FUNCTION:
  556. //   setAddButtonDisabled
  557. //
  558. // DESCRIPTION:
  559. //   Sets 
  560. //
  561. // ARGUMENTS:
  562. //   none
  563. //
  564. // RETURNS:
  565. //   true if successful, false otherwise
  566. //--------------------------------------------------------------------
  567.  
  568. function CustomizeFavorites_setAddButtonDisabled(trueOrFalse)
  569. {
  570.   var retValue = true; 
  571.   
  572.   var addButton = dwscripts.findDOMObject("addButton"); 
  573.    
  574.   if (addButton)
  575.   {
  576.     if (trueOrFalse)
  577.     {
  578.       addButton.setAttribute("disabled", true); 
  579.     } 
  580.     else
  581.     {
  582.       addButton.removeAttribute("disabled"); 
  583.     }
  584.   }
  585.   else
  586.   {
  587.     alert("Error: unable to find button labeled 'addButton'."); 
  588.   }
  589.  
  590.   return retValue; 
  591.  
  592.  
  593. //--------------------------------------------------------------------
  594. // FUNCTION:
  595. //   setAvailableObjects
  596. //
  597. // DESCRIPTION:
  598. //   Sets the available objects list  
  599. //
  600. // ARGUMENTS:
  601. //   domNode
  602. //
  603. // RETURNS:
  604. //   true if successful, false otherwise
  605. //--------------------------------------------------------------------
  606.  
  607. function CustomizeFavorites_setAvailableObjects(nodeID)
  608. {
  609.   var retValue = false; 
  610.  
  611.   var theDOM; 
  612.   var theCategory; 
  613.   var buttonNames = new Array(); 
  614.   var buttonValues = new Array(); 
  615.     
  616.   if (nodeID)
  617.   {
  618.     if (nodeID.toLowerCase() == "all")
  619.     {
  620.       theDOM = this.insertBarDOM; 
  621.     }
  622.     else 
  623.     {       
  624.       var theCategories =  this.insertBarDOM.getElementsByTagName("category");
  625.       
  626.       if (theCategories && theCategories.length)
  627.       {
  628.         for (var i=0; i<theCategories.length;++i)
  629.         {
  630.           if (theCategories[i].id && theCategories[i].id == nodeID)
  631.           {
  632.             theDOM = theCategories[i]; 
  633.             break; 
  634.           }
  635.         }
  636.       }
  637.     }
  638.     
  639.     if (theDOM) 
  640.     {
  641.       if (nodeID.toLowerCase() == "all")     
  642.       {
  643.         var theCategories = theDOM.getElementsByTagName("category");
  644.        
  645.         // if we have some categories 
  646.         if (theCategories && theCategories.length)
  647.         {                 
  648.           // for every category 
  649.           for (var z=0;z<theCategories.length;++z)
  650.           {
  651.             // if the current actegory node exists 
  652.             if (theCategories[z])
  653.             {
  654.               // and it has both a name and an ID 
  655.               if (theCategories[z].id && theCategories[z].id.length && theCategories[z].name && theCategories[z].name.length)
  656.               {           
  657.                 // and we're not dealing with the favorites (we want to exclude this) 
  658.                 if (theCategories[z].id != "DW_Insertbar_Favorites")
  659.                 {
  660.                   // for every category 
  661.                   // var cleanCategory = theCategories[z].id.replace("dw_InsertBar_", "", "gi"); 
  662.             
  663.                   // add to the button names the name and an empty string as the value 
  664.                   buttonNames.push(theCategories[z].name); 
  665.                   buttonValues.push(""); 
  666.               
  667.                   // grab all the the buttons for this category 
  668.                   var theButtons = theCategories[z].getElementsByTagName("button");            
  669.           
  670.                   // for every button in this category 
  671.                   for (var i=0;i<theButtons.length;++i)
  672.                   {  
  673.                     // if it has a name and an ID 
  674.                     if (theButtons[i].id && theButtons[i].id.length && theButtons[i].name && theButtons[i].name.length)
  675.                     {
  676.                       // push the button name and id 
  677.                       buttonNames.push(SPACER + theButtons[i].name); 
  678.                       buttonValues.push(theButtons[i].id); 
  679.                     }
  680.                   }
  681.                 }
  682.                 else
  683.                 {
  684.                   // ** There were no categories found. 
  685.                   // alert("Error: this category does not appear to have a valid category."); 
  686.                 }
  687.               }
  688.             }
  689.           }    
  690.         }
  691.       }
  692.       else 
  693.       {
  694.         // grab all the the buttons for this category 
  695.         var theButtons = theDOM.getElementsByTagName("button");            
  696.           
  697.         // for every button in this category 
  698.         for (var i=0;i<theButtons.length;++i)
  699.         {  
  700.           // if it has a name and an ID 
  701.           if (theButtons[i].id && theButtons[i].id.length && theButtons[i].name && theButtons[i].name.length)
  702.           {
  703.             // push the button name and id 
  704.             buttonNames.push(SPACER + theButtons[i].name); 
  705.             buttonValues.push(theButtons[i].id); 
  706.           }
  707.         }    
  708.       }
  709.     }
  710.   } 
  711.   else
  712.   {
  713.     alert("A nodeID was not passed."); 
  714.   }
  715.   
  716.   if (buttonNames.length)
  717.   {
  718.     this.AVAILABLE_OBJECTS_LIST.setAll(buttonNames,buttonValues); 
  719.   }
  720.   else
  721.   {
  722.     this.AVAILABLE_OBJECTS_LIST.setAll("",""); 
  723.   }
  724.   return retValue; 
  725.